﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ContratorMember.aspx.cs" Inherits="Catering.yl.Daily.ContratorMember" %>

<!DOCTYPE html>


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../../Style/center.css" />
    <link href="../../../Style/zhezhao.css"  rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/zhezhao.js" type="text/javascript"></script>
    <script src="../../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="../../../Style/center.css" /> 
    <script type="text/javascript" src="../../../Scripts/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#txt_CRegion").focus(function () { WdatePicker({ dateFmt: 'yyyy/MM/dd' }) });            
        });
        //显示添加
        function Add() {
            $("#txt_Name").val("");
            $("#txt_OClass").val("不可用");
            $("#txt_NClass").val("不可用");
            $("#txt_CardNum").val("");
            $("#txt_CardName").val("");  
            $("#txt_CRegion").val("<%=Session["CurrentDate"]%>");
            $("#txt_CPhone").val("");
            $("#txt_CDesc").val("");
            $("#txt_gongzhong").val("");
            $("#btnEdit").hide();
            $("#btnAdd").show();
            divshow("main", "bg");
        }
        //添加数据
        function btn_Add() {
            var txt_Name = $("#txt_Name").val();
            var txt_OClass = $("#txt_OClass").val();
            var txt_NClass = $("#txt_NClass").val(); 
            var txt_CardNum = $("#txt_CardNum").val(); 
            var txt_CardName = $("#txt_CardName").val();
            var txt_CRegion = $("#txt_CRegion").val();
            var txt_CPhone = $("#txt_CPhone").val();
            var txt_CDesc = $("#txt_CDesc").val();
            var txt_gongzhong = $("#txt_gongzhong").val();
            var hdn_useDate = $("#hdn_useDate").val();
            var hdn_currentClassID = $("#hdn_currentClassID").val();
            var hdn_currentGroupID = $("#hdn_currentGroupID").val();
            var hdn_contractorID = $("#hdn_contractorID").val();

            $.ajax({
                type: "Post",
                url: "ContratorMember.aspx/Add",
                data: "{'Name':'" + txt_Name + "','OClass':'" + txt_OClass + "','NClass':'" + txt_NClass + "','CardNum':'" + txt_CardNum + "','CardName':'" + txt_CardName + "','CRegion':'" + txt_CRegion + "','CPhone':'" + txt_CPhone + "','CDesc':'" + txt_CDesc + "','gongzhong':'" + txt_gongzhong + "','hdn_useDate':'" + hdn_useDate + "','hdn_currentClassID':'" + hdn_currentClassID + "','hdn_currentGroupID':'" + hdn_currentGroupID + "','hdn_contractorID':'" + hdn_contractorID + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",

                success: function (data) {
                    if (data.d == "OK") {
                        alert("保存成功！");
                        window.location.href = window.location.href;
                    }
                }
            });
        }
        function Edit(cid) {
            $("#HidID").val(cid);

            $.ajax({
                type: "Post",
                url: "ContratorMember.aspx/Get",
                data: "{'_id':'" + cid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    $("#txt_id").val(data.d[0] == null ? "" : data.d[0]);
                    $("#txt_Name").val(data.d[1] == null ? "" : data.d[1]);
                    $("#txt_OClass").val(data.d[2] == null ? "" : data.d[2]);
                    $("#txt_NClass").val(data.d[3] == null ? "" : data.d[3]);
                    $("#txt_CardNum").val(data.d[4] == null ? "" : data.d[4]);
                    $("#txt_CardName").val(data.d[5] == null ? "" : data.d[5]);
                    $("#txt_CRegion").val(data.d[6] == null ? "" : data.d[6]);
                    $("#txt_CPhone").val(data.d[7] == null ? "" : data.d[7]);
                    $("#txt_CDesc").val(data.d[8] == null ? "" : data.d[8]);
                    $("#txt_gongzhong").val(data.d[9] == null ? "" : data.d[9]);

                    $("#btnEdit").show();
                    $("#btnAdd").hide();
                    divshow("main", "bg");
                }
            });
        }
        //修改数据
        function btn_Edit() {
            var txt_Name = $("#txt_Name").val();
            var txt_OClass = $("#txt_OClass").val();
            var txt_NClass = $("#txt_NClass").val();
            var txt_CardNum = $("#txt_CardNum").val();
            var txt_CardName = $("#txt_CardName").val();
            var txt_CRegion = $("#txt_CRegion").val();
            var txt_CPhone = $("#txt_CPhone").val();
            var txt_CDesc = $("#txt_CDesc").val();
            var txt_gongzhong = $("#txt_gongzhong").val();
            var cid = $("#txt_id").val();
            var hdn_useDate = $("#hdn_useDate").val();
            var hdn_currentClassID = $("#hdn_currentClassID").val();
            var hdn_currentGroupID = $("#hdn_currentGroupID").val();
            var hdn_contractorID = $("#hdn_contractorID").val();

            $.ajax({
                type: "Post",
                url: "ContratorMember.aspx/Edit",
                data: "{'_id':'" + cid + "','Name':'" + txt_Name + "','OClass':'" + txt_OClass + "','NClass':'" + txt_NClass + "','CardNum':'" + txt_CardNum + "','CardName':'" + txt_CardName + "','CRegion':'" + txt_CRegion + "','CPhone':'" + txt_CPhone + "','CDesc':'" + txt_CDesc + "','gongzhong':'" + txt_gongzhong + "','hdn_useDate':'" + hdn_useDate + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "OK") {
                        alert("保存成功！");
                        window.location.href = window.location.href;
                    }
                }
            });
        }
        </script>
    <style type="text/css">
        .auto-style1 {
            width: 100px;
        }
    </style>
</head>
<body style="margin-top:0px; margin-left:0px">
    <form id="form1" runat="server">
        <input type="hidden" id="hdn_useDate" value='<%=Session["useDate"]%>' />
        <input type="hidden" id="hdn_currentClassID" value='<%=Session["ClassID"]%>' />
        <input type="hidden" id="hdn_currentGroupID" value='<%=Session["GroupID"]%>' />
        <input type="hidden" id="hdn_contractorID" value='<%=Session["ConMemberID"]%>' />
        <div class="xxk_button1">
        <ul style="margin-top:0px;">
            <li id="li3_1" class="li_out li_over"><a href="ContractorEdit.aspx">承包商信息</a> </li>
            <li id="li3_2" class="li_out"><a href="DailyEMtce.aspx">日常维护保养</a> </li>
            <li id="li3_3" class="li_out""><a href="CtionSupervision.aspx">小型施工监管</a> </li>            
        </ul>
        </div>
        <asp:HiddenField ID="HidID" runat="server" />  
     <div style="height: 46px; line-height: 40px; font-size: 13px; margin-left:30px;padding-top:10px; width:998px; margin:auto;background: url(/Images/div_h1_bg_02.gif);"> 
            <%--<asp:Button ID="Button1" style="float:right; margin:8px 5px; height:27px; width:83px;" runat="server" Text="导出Excel" CssClass="input_btn_a" OnClick="Button1_Click" />--%>
            <input id="New" type="button" value="新增" style="height:27px; width:83px;float:right; margin:8px 5px;" onclick="Add()" class="input_btn_a"/>
            <span style="font-size:15px">承包商名称:<%=Session["ConMember"]%></span>         
       </div>
        <table cellpadding="0" cellspacing="0" style="border-left:1px solid #8b8888;border-top:1px solid #8b8888; text-align:center; width:998px;margin:auto;font-size:12px;">
                <thead>
                    <tr style="background:url(../../../Images/th_02bg.gif) repeat-x 0px 0px; height:29px; ">
                        <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">序号
                        </td >
                        <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">姓名
                        </td>
                        <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">原班组
                        </td>
                        <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">现班组
                        </td>
                        <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">跟踪卡号
                        </td>
                        <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">身份证号
                        </td>
                        <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">证件有效区间
                        </td>                        
                        <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">电话
                        </td>  
                        <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">备注
                        </td> 
                        <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">工种
                        </td>
                        <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">操作                            
                        </td>                      
                    </tr>
                </thead>
                <tbody>
                    <asp:Repeater ID="Rep_Plan" runat="server" OnItemCommand="Rep_Plan_ItemCommand">
                        <ItemTemplate>
                            <tr>
                                <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                    <%#Eval("tempId")%>                                    
                                </td>
                                <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                    <%#Eval("CName")%>
                                </td>
                                <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                    <%#Eval("OldClassName")%>
                                </td>
                                <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                    <%#Eval("ClassName")%>
                                </td>
                                <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                    <%#Eval("CardNo")%>
                                </td>
                                <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                    <%#Eval("JobCard")%>
                                </td>
                                <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                    <%#Eval("Effective")%>
                                </td>                                
                                <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                    <%#Eval("Tel")%>
                                </td> 
                                <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                    <%#Eval("ConDesc")%>
                                </td>
                                <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                    <%#Eval("gongzhong")%>
                                </td>
                                <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                   <img alt="" title="编辑" src="../../../Images/file.gif" style="cursor: pointer;" onclick="Edit('<%#Eval("id")%>')"/>
                                    <asp:ImageButton ToolTip="删除" ID="ImageButton1" runat="server" ImageUrl="../../../Images/trash.gif" OnClientClick="return confirm('确认删除？');"
                                        CommandArgument='<%#Eval("id")%>' CommandName="del"/>
                                </td>                                                          
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>
        <!--弹出层-->
        <div id="bg" class="bg">
        </div>
        <div id="main" class="center_div" style="width: 400px; height: 300px; left:50%;top:10%;margin:-150px 0px 0px -200px;">
            <div class="div_0207" style="width: 398px; height: 100%; margin: 0px;">
                <h1>
                    <img src="../../../Images/cp_h1_03.gif" />添加承包商成员</h1>
                <table width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td height="40" class="auto-style1" align="right">
                            姓名:
                        </td>
                        <td class="auto-style1">
                            <asp:HiddenField ID="txt_id" runat="server" />  
                            <asp:TextBox ID="txt_Name" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox>                          
                        </td>
                        <td width="85" height="40" align="right">原班组:
                        </td>
                        <td width="65" height="40" align="right">
                            <asp:TextBox ID="txt_OClass" runat="server" CssClass="input_bg" Width="100px" Enabled="false"></asp:TextBox>                          
                        </td>                        
                    </tr>
                    <tr>
                        <td height="40" align="right" class="auto-style1">现班组:
                        </td>
                        <td class="auto-style1">
                            <asp:TextBox ID="txt_NClass" runat="server" CssClass="input_bg" Width="100px" Enabled="false"></asp:TextBox>                          
                        </td>
                        <td width="85" height="40" align="right">跟踪卡号:
                        </td>
                        <td>
                            <asp:TextBox ID="txt_CardNum" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox>                          
                        </td>               
                    </tr>
                    <tr>
                        <td height="40" align="right" class="auto-style1">身份证号:
                        </td>
                        <td class="auto-style1">
                            <asp:TextBox ID="txt_CardName" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox>                          
                        </td>
                        <td width="85" height="40" align="right">有效区间:
                        </td>
                        <td>
                            <asp:TextBox ID="txt_CRegion" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox>                            
                        </td>               
                    </tr>
                    <tr>
                        <td height="40" align="right" class="auto-style1">电话:
                        </td>
                        <td class="auto-style1">
                            <asp:TextBox ID="txt_CPhone" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox> 
                        </td>
                        <td width="85" height="40" align="right">备注:
                        </td>
                        <td>
                            <asp:TextBox ID="txt_CDesc" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox>                          
                        </td>                                                              
                    </tr>
                    <tr>
                        <td width="85" height="40" align="right">工种:
                        </td>
                        <td>
                            <asp:TextBox ID="txt_gongzhong" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox>                          
                        </td> 
                    </tr>
                </table>
                <table width="100%">
                    <tr>
                        <td height="30" align="right">
                            <input type="button" id="btnAdd" onclick="btn_Add()" class="input_btn_a" value="提交" />
                            <input type="button" id="btnEdit" onclick="btn_Edit()" class="input_btn_a" value="提交" />
                        </td>
                        <td>
                            <input type="button" id="but_Close" onclick='divhidel("main", "bg")' class="input_btn_a"
                                value="关闭" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </form>
</body>
</html>
